package com.audaque.encoding.entity;

import com.audaque.encoding.enums.DbTypeEnum;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;

/**
 * <p>
 * 源数据配置表
 * </p>
 *
 * @author mayong
 * @since 2024-04-03
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("t_source_config_new")
@Schema(name = "SourceConfigNewDO", description = "源数据配置表3.0版本")
public class SourceConfigNewDO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "赋码请求时文件名前缀(例如：309002_电梯，程序上追加文件后缀，完整示例309002_电梯_0430.xlsx") //309002_电梯 ,程序上追加_0430.xlsx
    @TableField("file_name_prefix")
    private String fileNamePrefix;

    @Schema(description = "pg数据库的数据库")
    @TableField("`database`")
    private String database;

    @Schema(description = "pg数据库的模式")
    @TableField("`schema`")
    private String schema;

    @Schema(description = "源表名（赋码数据的来源表）")
    @TableField("source_table_name")
    private String sourceTableName;

    @Schema(description = "目标pg数据库的数据库（写死）")
    @TableField("`target_database`")
    private String targetDatabase;

    @Schema(description = "目标pg数据库的模式")
    @TableField("`target_schema`")
    private String targetSchema;

    @Schema(description = "目标表名")
    @TableField("target_table_name")
    private String targetTableName;


    @Schema(description = "数据库类型: 1:mysql, 2:pg, 3:hive")
    @TableField(value = "type")
    private DbTypeEnum type;

    @Schema(description = "赋码标识字段")
    @TableField("result")
    private String result;

    @Schema(description = "赋码回调后的excel文件中的赋码结果字段名称")
    @TableField("result_name")
    private String resultName;

    /* 赋码回调回来后，需要找到的原来数据行的关联字段*/
    @Schema(description = "业务表id")
    @TableField("biz_id")
    private String bizId;

    @Schema(description = "业务表id的名称（comment）")
    @TableField("biz_Name")
    private String bizName;

    @Schema(description = "是否需要扫描")
    @TableField("scan")
    private Boolean scan;

    @Schema(description = "cron表达式类别")
    @TableField("cron_type")
    private Integer cronType;

    @Schema(description = "需要特殊处理的时间字段英文名称,如果有多个时用英文逗号连接")
    @TableField("time_fields")
    private String timeFields;

    @Schema(description = "赋码失败的原因")
    @TableField("remark")
    private String remark;

}
